1. Field of the Invention
The invention relates to a method for synchronizing clocks in nodes, for example in the form of control devices, of a vehicle network of a motor vehicle, in which the nodes communicate with one another by a communications protocol not synchronized per se, for example a bus system having an Ethernet protocol, and relates to a node designed to perform the method.
In the synchronization method according to the invention it is provided that a master node having a master clock sends out synchronization messages, which are evaluated in a slave node having a slave clock, wherein the timing signal of the slave node is adapted to the timing signal of the master node, in particular by adjusting the clock oscillator of the slave clock or of the slave node, or adapting the timing signal by other means, for instance by correction timing signals. In addition, in the method proposed according to the invention, the transmission delay for a message between the master node and the slave node is taken into account in correcting a time difference between the master clock and the slave clock.
2. Related Art
GB 2 246 677 A describes an optical terminal operated synchronously on different wavelength channels. When first switched on, the terminal sends out a signal, which is sent back from a star coupler to its own receiver in order to establish the length of the optical path from the receiver to the star coupler, if this has not already been established during installation. From the wavelength and the knowledge of the differential delay per wavelength, the delay is determined for each wavelength of the receiver, thereby achieving wavelength-synchronous operation of the terminal. This is not possible for packet-switched data transmission, however, because of the random delays that arise in this form of transmission.
EP 0 016 447 A1 discloses a method and a device for reconstructing voice data in a packet-switched telecommunications network, in which method and device the delay of a first data packet during transmission from the sender to the receiver is estimated in the active signal period, and this estimate is updated for time synchronization of the sender and the receiver, wherein the sender buffers the data packet for a time that depends on the estimated delay in order to minimize the variance of the data packets. This also has the problem, however, that at the start of communication, synchronization is performed initially on the basis of an estimate obtained from the first data packet, and therefore takes a relatively long time.
U.S. Pat. No. 5,623,483 describes a system for synchronizing a data stream by a control circuit which configures and initializes a buffer circuit to process and receive a data stream. The defined initialization parameters include a maximum acceptable packet loss rate and a maximum acceptable delay. In addition, a packet delay distribution is constructed, which describes the probability of a particular packet delay on the transmission path. This can be selected to be an initial approximation that is refined during operation. A first data packet is then inserted into the buffer in a position that is derived from a calculated delay. Subsequently received data packets, which contain information about their position relative to the first data packet, are slotted into the memory in an appropriate position. The data streams are hence synchronized, but not the clock generators in the sender and receiver, which is not essential for the purpose of transmitting these data streams.
On the other hand there are applications in which it is necessary to use a common time base in order to ensure the time synchronicity of different events (signals). Control devices in a motor vehicle that communicate with one another in a network via bus systems are a specific application example.
The common time base, and hence the time synchronicity of the nodes or networks, can be implemented in principle by the network itself. Bus systems such as FlexRay and MOST, which are currently used in motor vehicles, exist for this purpose and can establish this common time base. In these systems, synchronization times (starting from an initial asynchronicity, for example when the network is started up, to full synchronicity) of less than 100 ms are typical, as are necessary for applications in vehicles. Not all the networks or bus systems, however, have such a communications protocol that is synchronized per se. If the bus system or network that is designed to provide the communications link between the control devices or network nodes cannot, as such, establish the common time base, there is the option of achieving this by special protocols for time synchronization.
The Precision Time Protocol (PTP), based on versions v1 and v2 of standard IEEE1588, and the IEEE802.1AS protocol derived therefrom, are particularly suitable for this purpose and are widely established protocols for synchronizing network nodes that can each be used to establish a packet-based time synchronization between the individual network nodes.
These synchronization protocols are essentially based on there being a single master clock in a network and the other clocks behaving as slave clocks that synchronize themselves to this master clock. With regard to the clock, one network node therefore constitutes a master node to which the other nodes of the network relate as slave nodes (with respect to their clocks). The master clock is here typically the best quality clock in the network. During synchronization, the time offset of the slave clocks with respect to the master clock, and the transmission delays between the adjacent nodes, are determined. These values are then used for a clock correction of the slave clocks or slave nodes.
Unlike the bus systems such as FlexRay or MOST commonly used in motor vehicles, however, such synchronization protocols are not optimized for the first-time synchronization during start-up (restart) of the network, such as occurs, for example, when starting a motor vehicle. Thus the design of these protocols is such that during system start-up they require significantly longer synchronization times in the region of seconds. Synchronization using these PTP/IEEE802.1AS protocols cannot manage to synchronize network nodes or the clocks thereof during system start-up or restart in a synchronization time of less than one second.
The Ethernet version (“Ethernet AVB”) considered more closely in the automobile industry and which uses the IEEE802.1AS protocol in order to synchronize network nodes, i.e., in particular the individual control devices in the motor vehicle, also cannot manage synchronization times of less than one second. As already mentioned, this protocol is based on measuring the transmission delays between individual nodes and then incorporating these delays in a clock-offset correction. This known method is performed in two steps.
In a first step, the difference between the master clock and the slave clock is measured. For this purpose, the master clock sends out synchronization messages, which are sent out at a specific time t1 of the master clock, and are received at a time t2 of the slave clock, where the send time t1 of the master clock is transmitted to the slave clock by the synchronization message (either directly in a Sync message or an immediately following Follow-up message, which then jointly form the synchronization message). It is thereby possible, in particular by evaluating two successive synchronization messages, to adapt the clock speed of the slave clock to the clock speed of the master clock. This measurement or evaluation is performed in accordance with the intended standard based on the IEEE802.1 protocol at a time spacing of approximately 7 ms, for example specifically 7.8125 ms, to 64 s, in which the synchronization messages are sent out.
In the known synchronization methods, the transmission path is measured in time in a further step in order to be able to correct a time difference (offset between the clocks and delay arising from the transmission) between the master clock and the slave clock. For this purpose it is provided that the two-way delay, i.e., the time for a round-trip transmission from the slave clock or the slave node to the master clock or the master node, and back, is measured. To do this, the slave clock or the slave node sends out a Delay Request message, which is received by the master clock or master node. In response thereto, the master node or master clock sends out a Delay Response message, which is received in the slave node that sent out the Delay Request message. The respective send and receive times are recorded in the slave clock and the master clock so that it is then possible to determine the delay arising from the sending, and the offset of the slave clock with respect to the master clock. The time difference between the two clocks can thereby be determined and corrected.
This Delay Request cycle described above for correcting the time difference in accordance with the specification in the IEEE802.1AS protocol is only performed once per second, however. In a network having a plurality of nodes, this means that the total synchronization time can increase by one second for each node when the overall system is started. This protocol prevents these messages being sent out more frequently because otherwise the permanent load on the transmission channel in the network would be too great. In addition, an IEEE802.1AS network is initialized such that it configures and segments itself independently. In this regard, each node that is part of the network uses what is known as a “best master clock” (BMC) process in order to establish a best clock in the network or the current network segment. Under the Precision Time Protocol (PTP), each clock saves its properties in a specific data record and shares these properties with the other bus or network users in what are known as Announce messages. All the users or nodes can hence compare the data record of their current clock with the data record of the current master clock in the network, and adjust the clock configuration themselves, with the clock that has the best quality properties being declared the best master clock in the network.
The cyclical execution of this best master clock process by exchanging the Announce messages means that users can be added or removed while operation is in progress, which is also known as hot-plugging. During the restart (start-up) of a network, because of this best master clock process, the best clock is not known to any user, and therefore each user (node) assumes that it itself has the best clock until it learns from the Announce messages that the clocks of other users or nodes in the network are of better quality and uses these as the master clock.
The IEEE802.1AS protocol stipulates that the frequency of sending equals 1 Hz, i.e. the Announce messages are transmitted at a time spacing of just one second. This must again be understood against the background that transmitting this data more frequently in a network results in too great a basic load on the network in normal operation, and therefore the latency of the network would be too great for the actual data transmission if the Announce messages were transmitted at a higher rate.
Since during a restart of the network, the best clock of all the users of the system must be determined first in order to install this clock as the master clock of a master node, the minimum synchronization time is dictated by the number of nodes, because each neighbor transmits the Announce messages cyclically to its neighbors. Thus determining the best clock takes up to one second longer per node in the network. This disadvantage during the restart (start-up or boot-up) of the network is accepted in order to have overall a flexible network that automatically finds its best clock.